package com.shujia.mr.DianXin;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

//<0L,...>
//<>
public class DianXinMapper extends Mapper<LongWritable, Text, Text, LongWritable> {
    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, LongWritable>.Context context) throws IOException, InterruptedException {
        String line = value.toString();
        String PhoneNumber = null;
        String dateStamp = null;
        String city = null;
        String cityId = null;
        Long time = 0L;
        String JinruTime = null;
        String LikaiTime = null;
        String date = null;
        if (!line.startsWith("==") && !line.endsWith("\\N")) {
            String[] infos = line.split("\t");
            PhoneNumber = infos[0];
            dateStamp = infos[1];
            city = infos[2];
            cityId = infos[3];
            time = Long.valueOf(infos[4]);
            JinruTime = infos[5];
            LikaiTime = infos[6];
            date = infos[7];

        }
        context.write(new Text(PhoneNumber+"-"+city+"-"+cityId),new LongWritable(time));
    }
}
